//
//  NSData+RCExpand.m
//  StructToolsDemo
//
//  Created by 杨晓辉 on 2017/7/31.
//  Copyright © 2017年 杨晓辉. All rights reserved.
//

#import "NSData+RCExpand.h"
@implementation NSData (RCExpand)
- (NSData *)encodeBase64Data
{
    NSData *base64Data = [self base64EncodedDataWithOptions:0];
    return base64Data;
}
- (NSData *)decodeBase64Data
{
    return [self initWithBase64EncodedData:self options:0];
}
- (NSString *)transformToUTF8String
{
    NSString * utf8Str = [[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding];
    if (utf8Str) {
        [utf8Str UTF8String];
    }else{
    
      [[self base64EncodedStringWithOptions:0] UTF8String];
    }
    return utf8Str;
}



@end
